import tpl from './index.tpl';
import './index.scss';
import { tplReplace } from '../../libs/utils';

export default{
    name: 'Collector',
    collector(){
        return tplReplace(tpl,{
            type_class: 'full'
        })
    },
    unCollector(){
        return tplReplace(tpl,{
            type_class: 'o'
        })
    },
    bindEvent(doCollector){
        const oCollector = document.querySelector('.collector');
        console.log(oCollector);
        oCollector.addEventListener('click',this._setCollector.bind(this,oCollector,doCollector),false);
    },
    _setCollector(oCollector,doCollector){
        const className = oCollector.className;

        switch(className){
            case 'collector o':
                oCollector.className = 'collector full';
                doCollector(true);
                break;
            case 'collector full':
                oCollector.className = 'collector o';
                doCollector(false);
                break;
            default:
                break;
        }
    }
}